/*
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef WX_INTERFACE_LINK_INFO_H
#define WX_INTERFACE_LINK_INFO_H

#include <device_tree/interface/NetworkPort/LinkInfo.h>
#include <mc/core/timer.h>
#include <mc/engine/service.h>
#include <ncsi_over_mctp/ncsi_over_mctp_wx.h>

namespace dev {
using ncsi_over_mctp_wx_ptr = std::shared_ptr<ncsi_over_mctp_wx>;

class NetworkPort_LinkInfo
    : public mc::engine::interface<NetworkPort_LinkInfo, gen::NetworkPort_LinkInfo> {
public:
    NetworkPort_LinkInfo()  = default;
    ~NetworkPort_LinkInfo() = default;

public:
    // ncsi over mctp wx 自定义命令实现
    bool update_link_status_by_ncsi(uint8_t port_id);
    void start_ncsi_update_task_wx(ncsi_over_mctp_wx_ptr ncsi_over_mctp, mc::milliseconds interval,
                                   uint8_t port_id);
    void stop_ncsi_update_task();

private:
    ncsi_over_mctp_wx_ptr m_ncsi_over_mctp_wx;
    mc::core::timer*      m_ncsi_timer;
};

} // namespace dev

#endif